package com.example.web.service.cabinetstatus.impl;

import com.example.web.service.TimeIteratorNode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Slf4j
@Order(3)
@Component
public class GMTIteratorNodeImpl extends TimeIteratorNode {
    @Override
    public boolean condition(String timeStr) {
        log.info("check GMT");
        return false;
    }

    @Override
    public LocalDateTime parse(String timeStr) {
        log.info("use GMT");
        DateTimeFormatter rfc1123DateTime = DateTimeFormatter.RFC_1123_DATE_TIME;
        return LocalDateTime.parse(timeStr, rfc1123DateTime);
    }
}
